<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <!-- The following import relies on the msbuildtasks project http://msbuildtasks.tigris.org/ -->
  <Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/>
  <PropertyGroup>
    <SampleHostDirectory>Berico.SnagL.Host.Samples</SampleHostDirectory>
  </PropertyGroup>
  <ItemGroup>
    <DefaultExclude Include="**\.svn\**" />
    <DefaultExclude Include="**\bin\**" />
    <DefaultExclude Include="**\obj\**" />
    <DefaultExclude Include="**\Release\**" />
    <DefaultExclude Include="**\Debug\**" />
    <DefaultExclude Include="**\Test\**" />
    <DefaultExclude Include="**\TestResults\**" />
    <DefaultExclude Include="**\doc\**" />
    <DefaultExclude Include="**\www\**" />
    <DefaultExclude Include="**\*.user" />
    <DefaultExclude Include="**\*.suo" />
    <DefaultExclude Include="**\*.zip" />
    <DefaultExclude Include="**\*.txt" />
  </ItemGroup>
  <ItemGroup>
    <ZipFiles Include="**\$(SampleHostDirectory)\**" Exclude="@(DefaultExclude)" />
  </ItemGroup>
  <PropertyGroup Condition="$(Environment) == 'ver'">
    <WebProjectOutputDir>C:\inetpub\wwwroot\SnagL_Gen2\</WebProjectOutputDir>
    <OutDir>C:\inetpub\wwwroot\SnagL_Gen2\bin\</OutDir>
  </PropertyGroup>
  <PropertyGroup Condition="$(Environment) == 'val'">
    <WebProjectOutputDir>C:\Temp\SnagL2\</WebProjectOutputDir>
    <OutDir>C:\Temp\SnagL2\bin\</OutDir>
  </PropertyGroup>
  <Target Name="Build">
    <CallTarget Targets="Compile" />
    <CallTarget Targets="Publish" />
    <CallTarget Targets="Compress" />
  </Target>
  <Target Name="Compile">
    <MSBuild Projects="SnagL Gen 2.sln" Targets="Rebuild" Properties="Configuration=Release" ContinueOnError="false" />
  </Target>
  <Target Name="Publish" DependsOnTargets="Compile">
    <Message Text="Publishing SnagL to IIS" />
    <RemoveDir Directories="$(OutputFolder)" ContinueOnError="true" />
    <MSBuild Projects="$(SampleHostDirectory)\Berico.SnagL.Host.Samples.csproj"
             Targets="ResolveReferences;_CopyWebApplication"
             Properties="WebProjectOutputDir=$(WebProjectOutputDir);OutDir=$(OutDir);Configuration=Release" />
  </Target>
  <Target Name="Compress" DependsOnTargets="Compile">
    <Zip Files="@(ZipFiles)" ZipFileName="SampleHost.zip" />
  </Target>
</Project>